/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package swym.server;

import java.net.*;
import java.io.*;

/**
 *
 * @author mschaefer
 */
public class ClientSocket 
{
    private final Socket socket;
    private final ObjectOutputStream out;
    private final ObjectInputStream in;
    
    public ClientSocket( Socket socket ) throws IOException 
    {
        this.socket = socket;
        
        /* see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4162466 */
        out = new ObjectOutputStream( socket.getOutputStream() );
        in = new ObjectInputStream( socket.getInputStream() );
    }
    
    public ObjectOutputStream getOutputStream() { return out; }
    public ObjectInputStream getInputStream() { return in; }
    public Socket getSocket() { return socket; }
    
    public void close() throws IOException { socket.close(); }
    public boolean isConnected() { return socket.isConnected(); }
    public boolean isClosed() { return socket.isClosed(); }
}
